<template>
    <div class="add">
        <van-nav-bar
        title="新增页面"
        left-text="返回"
        left-arrow
        @click-left="onClickLeft"
        />
        <van-search v-model="inputText" placeholder="请输入搜索关键词" />
        <van-button plain hairline type="primary" @click="add">新增</van-button>
    </div>
</template>

<script setup>
import {ref} from 'vue'
import { useRouter } from 'vue-router'
import { useTasklistStore } from '../stores/tasklist'


var $router = useRouter()
var store = useTasklistStore()
var inputText = ref('')

var onClickLeft = () => {
    $router.push('/host')
}

var add = () => {
    store.addTask(inputText.value)
    inputText.value = ''
    $router.push('/host')
}

</script>


<style scoped>
.van-button {
    margin-right: 20px;
    margin-left: 20px;
    width: 90%;
}
</style>